import React, { Component } from 'react';
import { home_nav } from '../../utils/api.js'
import '../../components/Home/List.scss';

class List extends Component {
    constructor(props) {
        super(props);
        this.state = {
            list: [
            ]
        }
    }

    render() {
        return (
            <div className='list'>{
                this.state.list.map((item, index) => {
                    return (
                        <div className="cate" key={index}>
                            <img src={item.pic} alt="" />
                            <div>{item.name}</div>
                        </div>
                    )
                })
            }</div>
        )
    }
    componentDidMount() {
        console.log("主页导航按钮");
        home_nav().then((res) => {

            this.setState({
                list: res.data.list,
            })
        })
    }
}

export default List;